
package com.cptravel.activity.hot;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.core.controller.B5MBaseActivity;
import com.core.util.B5MActivityHelper;
import com.core.widget.autoscrollviewpager.AutoScrollViewPager;
import com.core.widget.viewpagerindicator.CirclePageIndicator;
import com.cptravel.R;
import com.cptravel.activity.order.BookJingQuActivity;
import com.cptravel.activity.order.BookJiuDianActivity;
import com.cptravel.adapter.HotDetailPagerAdapter;
import com.cptravel.bean.Xiangxi;
import com.cptravel.view.NoScrollWebView;

public class HotDetailItemDescActivity extends B5MBaseActivity
{
    private AutoScrollViewPager mPager;
    private CirclePageIndicator mIndicator;
    private HotDetailPagerAdapter mIndexPagerAdapter;
    private Xiangxi xiangxi;
    private TextView tv_name, tv_price;
    private NoScrollWebView tv_desc;

    @Override
    protected String getHeadTitle()
    {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public int doGetContentViewId()
    {
        // TODO Auto-generated method stub
        return R.layout.hot_detail_item_desc;
    }

    @Override
    public void doInitSubViews(View containerView)
    {
        // TODO Auto-generated method stub
        mIndexPagerAdapter = new HotDetailPagerAdapter(getSupportFragmentManager());
        mPager = (AutoScrollViewPager) containerView.findViewById(R.id.pager);
        mPager.setAdapter(mIndexPagerAdapter);
        mPager.setInterval(3000);
        mIndicator = (CirclePageIndicator) containerView.findViewById(R.id.indicator);
        mIndicator.setViewPager(mPager);
        tv_name = (TextView) findViewById(R.id.tv_name);
        tv_price = (TextView) findViewById(R.id.tv_price);
        tv_desc = (NoScrollWebView) findViewById(R.id.tv_desc);
    }

    @Override
    public void doInitDataes()
    {
        // TODO Auto-generated method stub
        xiangxi = (Xiangxi) getIntent().getSerializableExtra("xiangxi");
        tv_title.setText(xiangxi.title);
        mIndexPagerAdapter.pics.addAll(xiangxi.img);
        mIndexPagerAdapter.notifyDataSetChanged();
        tv_name.setText(xiangxi.title);
        tv_price.setText(xiangxi.price + "元");
        tv_desc.loadDataWithBaseURL(null, xiangxi.desc, "text/html", "utf-8", null);
    }

    @Override
    public void doAfter()
    {
        // TODO Auto-generated method stub
    }

    public void toBook(View view)
    {
        Bundle bundle = new Bundle();
        bundle.putSerializable("xiangxi", xiangxi);
        if ("1".equals(xiangxi.classid))//1酒店房间2景区
        {
            B5MActivityHelper.startActivity(mActivity, BookJiuDianActivity.class, bundle);
        }
        else
        {
            B5MActivityHelper.startActivity(mActivity, BookJingQuActivity.class, bundle);
        }
    }
}
